package com.ruoyi.yf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.yf.mapper.YfBucketMapper;
import com.ruoyi.yf.domain.YfBucket;
import com.ruoyi.yf.service.IYfBucketService;
import com.ruoyi.common.core.text.Convert;

/**
 * 垃圾桶Service业务层处理
 * 
 * @author XiaoYi...
 * @date 2020-03-17
 */
@Service
public class YfBucketServiceImpl implements IYfBucketService 
{
    @Autowired
    private YfBucketMapper yfBucketMapper;

    /**
     * 查询垃圾桶
     * 
     * @param bucketId 垃圾桶ID
     * @return 垃圾桶
     */
    @Override
    public YfBucket selectYfBucketById(Long bucketId)
    {
        return yfBucketMapper.selectYfBucketById(bucketId);
    }

    /**
     * 查询垃圾桶列表
     * 
     * @param yfBucket 垃圾桶
     * @return 垃圾桶
     */
    @Override
    public List<YfBucket> selectYfBucketList(YfBucket yfBucket)
    {
        return yfBucketMapper.selectYfBucketList(yfBucket);
    }

    /**
     * 新增垃圾桶
     * 
     * @param yfBucket 垃圾桶
     * @return 结果
     */
    @Override
    public int insertYfBucket(YfBucket yfBucket)
    {
        yfBucket.setCreateTime(DateUtils.getNowDate());
        return yfBucketMapper.insertYfBucket(yfBucket);
    }

    /**
     * 修改垃圾桶
     * 
     * @param yfBucket 垃圾桶
     * @return 结果
     */
    @Override
    public int updateYfBucket(YfBucket yfBucket)
    {
        yfBucket.setUpdateTime(DateUtils.getNowDate());
        return yfBucketMapper.updateYfBucket(yfBucket);
    }

    /**
     * 删除垃圾桶对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteYfBucketByIds(String ids)
    {
        return yfBucketMapper.deleteYfBucketByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除垃圾桶信息
     * 
     * @param bucketId 垃圾桶ID
     * @return 结果
     */
    @Override
    public int deleteYfBucketById(Long bucketId)
    {
        return yfBucketMapper.deleteYfBucketById(bucketId);
    }
}
